package collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {
        List<String> list = new LinkedList<>();
        list.add("我");
        list.add("真");
        list.add("帅");
        
        String s = list.get(2);
        System.out.println(s);

        for (String s1 : list) {
            System.out.println(s1);
        }


        Iterator<String> it = list.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }

        String old = list.set(2,"酷");
        System.out.println(list);
        System.out.println(old);


        String a = list.remove(1);
        System.out.println(list);
        System.out.println(a);

        list.add(1,"太他妈");
        System.out.println(list);

    }
}
